/*
  Copyright (c), 2001-2024, Shenshu Tech. Co., Ltd.
 */

#ifndef HI_AACDEC_H
#define HI_AACDEC_H

#include "hi_type.h"
#include "ot_aacdec.h"

#ifdef __cplusplus
extern "C" {
#endif

#define HI_AAC_MAX_CHN_NUM OT_AAC_MAX_CHN_NUM
#define HI_AAC_MAX_SAMPLE_NUM OT_AAC_MAX_SAMPLE_NUM
#define HI_AAC_MAINBUF_SIZE OT_AAC_MAINBUF_SIZE
#define HI_AAC_NUM_PROFILES OT_AAC_NUM_PROFILES
#define HI_AAC_PROFILE_MP OT_AAC_PROFILE_MP
#define HI_AAC_PROFILE_LC OT_AAC_PROFILE_LC
#define HI_AAC_PROFILE_SSR OT_AAC_PROFILE_SSR
#define HI_AACDEC_VERSION_MAX_BYTE OT_AACDEC_VERSION_MAX_BYTE
#define HI_ERR_AAC_NONE OT_ERR_AAC_NONE
#define HI_ERR_AAC_INDATA_UNDERFLOW OT_ERR_AAC_INDATA_UNDERFLOW
#define HI_ERR_AAC_NULL_POINTER OT_ERR_AAC_NULL_POINTER
#define HI_ERR_AAC_INVALID_ADTS_HEADER OT_ERR_AAC_INVALID_ADTS_HEADER
#define HI_ERR_AAC_INVALID_ADIF_HEADER OT_ERR_AAC_INVALID_ADIF_HEADER
#define HI_ERR_AAC_INVALID_FRAME OT_ERR_AAC_INVALID_FRAME
#define HI_ERR_AAC_MPEG4_UNSUPPORTED OT_ERR_AAC_MPEG4_UNSUPPORTED
#define HI_ERR_AAC_CHANNEL_MAP OT_ERR_AAC_CHANNEL_MAP
#define HI_ERR_AAC_SYNTAX_ELEMENT OT_ERR_AAC_SYNTAX_ELEMENT
#define HI_ERR_AAC_DEQUANT OT_ERR_AAC_DEQUANT
#define HI_ERR_AAC_STEREO_PROCESS OT_ERR_AAC_STEREO_PROCESS
#define HI_ERR_AAC_PNS OT_ERR_AAC_PNS
#define HI_ERR_AAC_SHORT_BLOCK_DEINT OT_ERR_AAC_SHORT_BLOCK_DEINT
#define HI_ERR_AAC_TNS OT_ERR_AAC_TNS
#define HI_ERR_AAC_IMDCT OT_ERR_AAC_IMDCT
#define HI_ERR_AAC_NCHANS_TOO_HIGH OT_ERR_AAC_NCHANS_TOO_HIGH
#define HI_ERR_AAC_SBR_INIT OT_ERR_AAC_SBR_INIT
#define HI_ERR_AAC_SBR_BITSTREAM OT_ERR_AAC_SBR_BITSTREAM
#define HI_ERR_AAC_SBR_DATA OT_ERR_AAC_SBR_DATA
#define HI_ERR_AAC_SBR_PCM_FORMAT OT_ERR_AAC_SBR_PCM_FORMAT
#define HI_ERR_AAC_SBR_NCHANS_TOO_HIGH OT_ERR_AAC_SBR_NCHANS_TOO_HIGH
#define HI_ERR_AAC_SBR_SINGLERATE_UNSUPPORTED OT_ERR_AAC_SBR_SINGLERATE_UNSUPPORTED
#define HI_ERR_AAC_RAWBLOCK_PARAMS OT_ERR_AAC_RAWBLOCK_PARAMS
#define HI_ERR_AAC_PS_INIT OT_ERR_AAC_PS_INIT
#define HI_ERR_AAC_CH_MAPPING OT_ERR_AAC_CH_MAPPING
#define HI_ERR_AAC_WRAP_UNKNOWN OT_ERR_AAC_WRAP_UNKNOWN
#define HI_ERR_AAC_OUT_OF_MEMORY OT_ERR_AAC_OUT_OF_MEMORY
#define HI_ERR_AAC_UNKNOWN OT_ERR_AAC_UNKNOWN
#define HI_ERR_AAC_TRANSPORT_SYNC_ERROR OT_ERR_AAC_TRANSPORT_SYNC_ERROR
#define HI_ERR_AAC_NOT_ENOUGH_BITS OT_ERR_AAC_NOT_ENOUGH_BITS
#define HI_ERR_AAC_TRANSPORT_FATAL_ERROR OT_ERR_AAC_TRANSPORT_FATAL_ERROR
#define HI_ERR_AAC_INVALID_HANDLE OT_ERR_AAC_INVALID_HANDLE
#define HI_ERR_AAC_UNSUPPORTED_AOT OT_ERR_AAC_UNSUPPORTED_AOT
#define HI_ERR_AAC_UNSUPPORTED_FORMAT OT_ERR_AAC_UNSUPPORTED_FORMAT
#define HI_ERR_AAC_UNSUPPORTED_ER_FORMAT OT_ERR_AAC_UNSUPPORTED_ER_FORMAT
#define HI_ERR_AAC_UNSUPPORTED_EPCONFIG OT_ERR_AAC_UNSUPPORTED_EPCONFIG
#define HI_ERR_AAC_UNSUPPORTED_MULTILAYER OT_ERR_AAC_UNSUPPORTED_MULTILAYER
#define HI_ERR_AAC_UNSUPPORTED_CHANNELCONFIG OT_ERR_AAC_UNSUPPORTED_CHANNELCONFIG
#define HI_ERR_AAC_UNSUPPORTED_SAMPLINGRATE OT_ERR_AAC_UNSUPPORTED_SAMPLINGRATE
#define HI_ERR_AAC_INVALID_SBR_CONFIG OT_ERR_AAC_INVALID_SBR_CONFIG
#define HI_ERR_AAC_SET_PARAM_FAIL OT_ERR_AAC_SET_PARAM_FAIL
#define HI_ERR_AAC_NEED_TO_RESTART OT_ERR_AAC_NEED_TO_RESTART
#define HI_ERR_AAC_TRANSPORT_ERROR OT_ERR_AAC_TRANSPORT_ERROR
#define HI_ERR_AAC_PARSE_ERROR OT_ERR_AAC_PARSE_ERROR
#define HI_ERR_AAC_UNSUPPORTED_EXTENSION_PAYLOAD OT_ERR_AAC_UNSUPPORTED_EXTENSION_PAYLOAD
#define HI_ERR_AAC_DECODE_FRAME_ERROR OT_ERR_AAC_DECODE_FRAME_ERROR
#define HI_ERR_AAC_CRC_ERROR OT_ERR_AAC_CRC_ERROR
#define HI_ERR_AAC_INVALID_CODE_BOOK OT_ERR_AAC_INVALID_CODE_BOOK
#define HI_ERR_AAC_UNSUPPORTED_PREDICTION OT_ERR_AAC_UNSUPPORTED_PREDICTION
#define HI_ERR_AAC_UNSUPPORTED_CCE OT_ERR_AAC_UNSUPPORTED_CCE
#define HI_ERR_AAC_UNSUPPORTED_LFE OT_ERR_AAC_UNSUPPORTED_LFE
#define HI_ERR_AAC_UNSUPPORTED_GAIN_CONTROL_DATA OT_ERR_AAC_UNSUPPORTED_GAIN_CONTROL_DATA
#define HI_ERR_AAC_UNSUPPORTED_SBA OT_ERR_AAC_UNSUPPORTED_SBA
#define HI_ERR_AAC_TNS_READ_ERROR OT_ERR_AAC_TNS_READ_ERROR
#define HI_ERR_AAC_RVLC_ERROR OT_ERR_AAC_RVLC_ERROR
#define HI_ERR_AAC_ANC_DATA_ERROR OT_ERR_AAC_ANC_DATA_ERROR
#define HI_ERR_AAC_TOO_SMALL_ANC_BUFFER OT_ERR_AAC_TOO_SMALL_ANC_BUFFER
#define HI_ERR_AAC_TOO_MANY_ANC_ELEMENTS OT_ERR_AAC_TOO_MANY_ANC_ELEMENTS
typedef ot_aacdec_err hi_aacdec_err;
typedef ot_aacdec_frame_info hi_aacdec_frame_info;
#define HI_AACDEC_ADTS OT_AACDEC_ADTS
#define HI_AACDEC_LOAS OT_AACDEC_LOAS
#define HI_AACDEC_LATM_MCP1 OT_AACDEC_LATM_MCP1
typedef ot_aacdec_transport_type hi_aacdec_transport_type;
typedef ot_aacdec_version hi_aacdec_version;
typedef ot_aac_decoder hi_aac_decoder;

hi_s32 hi_aacdec_get_version(hi_aacdec_version *version);

hi_aac_decoder hi_aacdec_init_decoder(hi_aacdec_transport_type transport_type);

hi_void hi_aacdec_free_decoder(hi_aac_decoder aac_decoder);

hi_s32 hi_aacdec_set_raw_mode(hi_aac_decoder aac_decoder, hi_s32 chn_num, hi_s32 sample_rate);

hi_s32 hi_aacdec_find_sync_header(hi_aac_decoder aac_decoder, hi_u8 **in_buf, hi_s32 *bytes_left);

hi_s32 hi_aacdec_frame(hi_aac_decoder aac_decoder, hi_u8 **in_buf, hi_s32 *bytes_left, hi_s16 *out_pcm);

hi_s32 hi_aacdec_set_eos_flag(hi_aac_decoder aac_decoder, hi_s32 eos_flag);

hi_s32 hi_aacdec_get_last_frame_info(hi_aac_decoder aac_decoder, hi_aacdec_frame_info *frame_info);

hi_s32 hi_aacdec_flush_codec(hi_aac_decoder aac_decoder);

hi_s32 hi_aacdec_register_mod(const hi_void *mod_handle);

hi_void *hi_aac_sbrdec_get_handle(hi_void);

#ifdef __cplusplus
}
#endif
#endif /* HI_AACDEC_H */
